Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.12] [Security Solution] "Data view" selector is shown in "Edit filter" view on the Rule Editing page (#174026) (#174922) #175433

Merged
merged 4 commits into from
Jan 25, 2024

Conversation

kibanamachine
Copy link
Contributor

Backport

This will backport the following commits from main to 8.12:

Questions ?

Please refer to the Backport tool documentation

…ew on the Rule Editing page (elastic#174026) (elastic#174922)

## Summary

Addresses elastic#174026

These changes fix the issue with filter editing on the rule's editing
page when using index patterns instead of data view.

**Steps to reproduce**:
1. Create a custom query rule and add a filter
2. Save the rule
3. Edit the rule
4. Edit the filter

**Current behaviour**:
Right now when user tries to edit the filter the data view picking UI
appears even though index patterns were not modified.

<img width="1261" alt="Screenshot 2024-01-16 at 15 14 23"
src="https://github.com/elastic/kibana/assets/2700761/b2d28b79-a7d8-482c-a2be-fa8e20cb9e25">

**Expected behaviour**:
Data view picking UI should not be present and previously set field and
value options should be shown in the filter editing dialog.

<img width="1252" alt="Screenshot 2024-01-16 at 15 16 07"
src="https://github.com/elastic/kibana/assets/2700761/bb99dd9f-aa6a-4003-b8c4-ccda344c4c5c">

**Cause**:
The behaviour for the filter editing on rule’s editing page changed in
`8.11` with these changes elastic#166318.
We convert `DataViewBase` object without ID set to a `DataView` object
with auto-generated ID. This happens each time we try to edit the rule
and leads to a different ID which is saved in `filter.meta.index`.
Unified search internally checks those IDs to verify whether the filter
belongs to provided data view.

**Solution**:
To solve this issue, we set the data view id explicitly on creating an
in-memory data view that represents index patterns and update
`filter.meta.index` to use the same ID.

~~**Known issue**:
This does not resolve the issue for existing filters. In this case, user
will need to update their filters manually.~~ (This was fixed by
updating `filter.meta.index` field on rule editing)

**Flaky test runner**
[ESS 50
times](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4927)
[Serverless 50
times](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4935)

---------

Co-authored-by: Kibana Machine <[email protected]>
(cherry picked from commit f0f6274)
@kibanamachine kibanamachine merged commit 0217287 into elastic:8.12 Jan 25, 2024
31 checks passed
@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #51 / machine learning - data frame analytics custom urls "before all" hook in "custom urls"

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
securitySolution 13.1MB 13.1MB +490.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @e40pud

e40pud added a commit that referenced this pull request Jan 26, 2024
## Summary

This is a followup to #174922.
While doing [backport](#175433) of
that PR, I found that tests are failing in 8.12 because of not using
state updating path for updating `filters` property of the component.
This led to stale version of `filters` property being passed to the
`SearchBar` component and thus the initial fix was not working.


[Here](532178b)
is the fix for 8.12 which was cherry-picked here.

### Checklist

- [x] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ESS 50
times](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4955)
- [Serverless 50
times](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4956)
CoenWarmer pushed a commit to CoenWarmer/kibana that referenced this pull request Feb 15, 2024
## Summary

This is a followup to elastic#174922.
While doing [backport](elastic#175433) of
that PR, I found that tests are failing in 8.12 because of not using
state updating path for updating `filters` property of the component.
This led to stale version of `filters` property being passed to the
`SearchBar` component and thus the initial fix was not working.


[Here](elastic@532178b)
is the fix for 8.12 which was cherry-picked here.

### Checklist

- [x] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ESS 50
times](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4955)
- [Serverless 50
times](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4956)
kibanamachine added a commit that referenced this pull request Mar 12, 2024
…om Rule after upgrade to 8.12 (#177838) (#178207) (#178484)

# Backport

This will backport the following commits from `main` to `8.13`:
- [[Security Solution] Cannot edit, add or remove filters on Custom Rule
after upgrade to 8.12 (#177838)
(#178207)](#178207)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Ievgen
Sorokopud","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-03-12T10:55:37Z","message":"[Security
Solution] Cannot edit, add or remove filters on Custom Rule after
upgrade to 8.12 (#177838) (#178207)\n\n## Summary\r\n\r\nAddresses
https://github.com/elastic/kibana/issues/177838\r\n\r\nThese changes fix
the bug where users do not receive UI feedback on\r\nadd/remove/edit
filters inside security solution rules. It happens when\r\nuser selects
data view as a source and works correctly with
index\r\npatterns.\r\n\r\nThe issue was introduced with these
changes\r\nhttps://github.com//pull/175433/files# where we
update\r\nfilters with the ad-hoc data view id. Since new state variable
is\r\nupdated only when current source is an index
pattern.\r\n\r\n**Fix**: we should always update `searchBarFilters`
state variable on\r\nsource/filters
updates.\r\n\r\n\r\nhttps://github.com/elastic/kibana/assets/2700761/5d8d3932-3fc7-4a5c-a647-4fa2ceda71b2\r\n\r\nAlso,
I added e2e tests to verify that we are able to add filters on\r\nrule
creation working with both source types.\r\n\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [x] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [x] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- [x] [ESS
50\r\ntimes](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5428)\r\n-
[x] [Serverless
50\r\ntimes](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5410)\r\n\r\n---------\r\n\r\nCo-authored-by:
Kibana Machine
<[email protected]>","sha":"22365e6d4a14e06c6de559bc98c117088ce4f37d","branchLabelMapping":{"^v8.14.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:
SecuritySolution","backport:prev-minor","Team:Detection
Engine","v8.13.0","v8.14.0","v8.13.1"],"title":"[Security Solution]
Cannot edit, add or remove filters on Custom Rule after upgrade to 8.12
(#177838)","number":178207,"url":"https://github.com/elastic/kibana/pull/178207","mergeCommit":{"message":"[Security
Solution] Cannot edit, add or remove filters on Custom Rule after
upgrade to 8.12 (#177838) (#178207)\n\n## Summary\r\n\r\nAddresses
https://github.com/elastic/kibana/issues/177838\r\n\r\nThese changes fix
the bug where users do not receive UI feedback on\r\nadd/remove/edit
filters inside security solution rules. It happens when\r\nuser selects
data view as a source and works correctly with
index\r\npatterns.\r\n\r\nThe issue was introduced with these
changes\r\nhttps://github.com//pull/175433/files# where we
update\r\nfilters with the ad-hoc data view id. Since new state variable
is\r\nupdated only when current source is an index
pattern.\r\n\r\n**Fix**: we should always update `searchBarFilters`
state variable on\r\nsource/filters
updates.\r\n\r\n\r\nhttps://github.com/elastic/kibana/assets/2700761/5d8d3932-3fc7-4a5c-a647-4fa2ceda71b2\r\n\r\nAlso,
I added e2e tests to verify that we are able to add filters on\r\nrule
creation working with both source types.\r\n\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [x] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [x] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- [x] [ESS
50\r\ntimes](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5428)\r\n-
[x] [Serverless
50\r\ntimes](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5410)\r\n\r\n---------\r\n\r\nCo-authored-by:
Kibana Machine
<[email protected]>","sha":"22365e6d4a14e06c6de559bc98c117088ce4f37d"}},"sourceBranch":"main","suggestedTargetBranches":["8.13"],"targetPullRequestStates":[{"branch":"8.13","label":"v8.13.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.14.0","branchLabelMappingKey":"^v8.14.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/178207","number":178207,"mergeCommit":{"message":"[Security
Solution] Cannot edit, add or remove filters on Custom Rule after
upgrade to 8.12 (#177838) (#178207)\n\n## Summary\r\n\r\nAddresses
https://github.com/elastic/kibana/issues/177838\r\n\r\nThese changes fix
the bug where users do not receive UI feedback on\r\nadd/remove/edit
filters inside security solution rules. It happens when\r\nuser selects
data view as a source and works correctly with
index\r\npatterns.\r\n\r\nThe issue was introduced with these
changes\r\nhttps://github.com//pull/175433/files# where we
update\r\nfilters with the ad-hoc data view id. Since new state variable
is\r\nupdated only when current source is an index
pattern.\r\n\r\n**Fix**: we should always update `searchBarFilters`
state variable on\r\nsource/filters
updates.\r\n\r\n\r\nhttps://github.com/elastic/kibana/assets/2700761/5d8d3932-3fc7-4a5c-a647-4fa2ceda71b2\r\n\r\nAlso,
I added e2e tests to verify that we are able to add filters on\r\nrule
creation working with both source types.\r\n\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [x] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [x] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- [x] [ESS
50\r\ntimes](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5428)\r\n-
[x] [Serverless
50\r\ntimes](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5410)\r\n\r\n---------\r\n\r\nCo-authored-by:
Kibana Machine
<[email protected]>","sha":"22365e6d4a14e06c6de559bc98c117088ce4f37d"}}]}]
BACKPORT-->

Co-authored-by: Ievgen Sorokopud <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants